package net.wanho.customerManage.dao.impl;

import net.wanho.commons.exception.DaoException;
import net.wanho.commons.exception.DataAccessException;
import net.wanho.commons.factory.BeanFactory;
import net.wanho.commons.util.JDBCTemplate;
import net.wanho.customerManage.dao.AdvancedLogDao;
import net.wanho.customerManage.po.AdvancedLog;

public class AdvancedLogDaoImpl implements AdvancedLogDao {
    private JDBCTemplate jdbcTemplate = BeanFactory.getBean(JDBCTemplate.class) ;
    @Override
    public Integer insertAdvancedLog(AdvancedLog advancedLog) throws DaoException {
        final String INSERT_ADVANCED_LOG_SQL = "INSERT INTO advanced_log (LOG_ID, BUSINESS_ID, CREATOR, ADVANCE_CONTENT, CREATE_TIME, ADVANCE_STATUS) VALUES (?, ?, ?,?, ?,?)" ;
        try {
            Object[] params = {advancedLog.getLogId(),advancedLog.getBusinessId(),advancedLog.getCreator(),advancedLog.getAdvanceContent(),advancedLog.getCreateTime(),advancedLog.getAdvanceStatus()} ;
            return jdbcTemplate.save(INSERT_ADVANCED_LOG_SQL,params);
        } catch (DataAccessException e) {
            e.printStackTrace();
            throw new DaoException(e.getMessage()) ;
        }
    }
}
